#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
void reverse(int* arr, int start, int end)
{
    int tmp;
    while (start < end)
    {
        tmp = arr[start];
        arr[start] = arr[end];
        arr[end] = tmp;
        start++;
        end--;
    }
}
int cmp(int* a, int* b) {
    return *a - *b;
}

void merge1(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n) {
    for (int i = 0; i != n; ++i)
    {
        nums1[m + i] = nums2[i];
    }
    qsort(nums1, nums1Size, sizeof(int), cmp);
}
void merge2(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n)
{
    int arr[20] = { 0 };
    int i = 0;
    int j = 0;
    int k = 0;
    for (k = 0; k < m + n; k++)
    {
        if (i == m)
        {
            arr[k] = nums2[j++];
        }
        else if (j == n)
        {
            arr[k] = nums1[i++];
        }
        else if (nums1[i] < nums2[j])
        {
            arr[k] = nums1[i++];
        }
        else
        {
            arr[k] = nums2[j++];

        }
    }
    for (k = 0; k < m + n; k++)
    {
        nums1[k] = arr[k];
    }
}